// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   CMIComments.java

package com.iphaeton.lms.course.scorm12.datamodel.cmi;

import com.iphaeton.lms.course.scorm12.DebugIndicator;
import com.iphaeton.lms.course.scorm12.datamodel.Element;
import java.io.PrintStream;
import java.io.Serializable;

// Referenced classes of package com.iphaeton.lms.course.scorm12.datamodel.cmi:
//            CMICategory, CMIRequest, DMErrorManager

public class CMIComments extends CMICategory
    implements Serializable
{

    public CMIComments(String commentsString)
    {
        super(true);
        comments = new Element(commentsString, "checkString4096", "NULL", true, true, false);
    }

    public CMIComments()
    {
        super(true);
        comments = new Element("", "checkString4096", "NULL", true, true, false);
    }

    public Element getComments()
    {
        return comments;
    }

    public void setComments(String inComments)
    {
        comments.setValue(inComments);
    }

    public String performGet(CMIRequest theRequest, DMErrorManager dmErrorMgr)
    {
        String result = new String("");
        if(theRequest.hasMoreTokensToProcess())
        {
            if(_Debug)
            {
                System.out.println("Error - Data Model Element not implemented");
                System.out.println("Element being processed: " + theRequest.getElement() + "is not a valid data model element.\n");
            }
            if(theRequest.isAKeywordRequest())
                dmErrorMgr.recGetKeyWordError(theRequest.getElement());
            else
                dmErrorMgr.recNotImplementedError(theRequest);
        } else
        {
            result = comments.getValue();
        }
        theRequest.done();
        return result;
    }

    public void performSet(CMIRequest theRequest, DMErrorManager dmErrorMgr)
    {
        if(!theRequest.hasMoreTokensToProcess())
        {
            String content = theRequest.getValue();
            if(content.length() <= 4096)
            {
                String currentComments = comments.getValue();
                currentComments = currentComments + content;
                comments.setValue(currentComments);
            } else
            {
                if(_Debug)
                {
                    System.out.println("***** INVALID LMSSetValue() CALL *****");
                    System.out.println("             Invalid Type             ");
                    System.out.println("         Element was not set!         ");
                }
                dmErrorMgr.SetCurrentErrorCode("405");
            }
        } else
        {
            if(_Debug)
            {
                System.out.println("Error - Data Model Element not implemented");
                System.out.println("Element being processed: " + theRequest.getElement() + "is not a valid data model element.\n");
            }
            dmErrorMgr.recNotImplementedError(theRequest);
        }
        theRequest.done();
    }

    private static final long serialVersionUID = 0xd53e84e1c09b09d6L;
    private static boolean _Debug;
    public Element comments;

    static 
    {
        _Debug = DebugIndicator.ON;
    }
}
